package com.jingyi.web.controller.system;

import com.jingyi.system.domain.SysUser;
import com.jingyi.system.service.ISysUserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * 登录验证
 *
 * @author linzhihai
 */
@RestController
public class SysLoginController
{
    @Resource
    private ISysUserService userService;

    /**
     * 登录方法
     *
     * @param sysUser 用户信息
     * @return 结果
     */
    @PostMapping("/login")
    public Map<String, Object> login(@RequestBody SysUser sysUser)
    {
        Map<String, Object> result = new HashMap<>();
        SysUser user = userService.selectUserByUserNameAndPassword(sysUser);
        result.put("user", user);
        return result;
    }

}
